#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n, q; // n  数组的长度  q 查询的次数
    cin >> n >> q;
    vector<int> arr(n);
    for (int i = 0; i < n; i++)
    {
        cin >> arr[i];
    }
    // 
    while (q--)
    {
        int x;
        cin >> x;
        int l = -1, r = n;
        // 寻找第一个等于K的坐标 我这边让二分的边界定为 左边为<5 右边>=5 则所求为r
        while (l + 1 != r)
        {
            int mid = l + r >> 1;
            if (arr[mid] >= x) // [1 2 2][ 3 3 4]   ----3
            {
                r = mid;
            }
            else
            {
                l = mid;
            }
        }
        if (arr[r] != x)
        {
            cout << "-1 -1" << endl;
        }
        else
        {
            cout << r << " ";
            // 寻找最后一个等于K的坐标 我这边让二分的边界定为 左边为<=5 右边>5 则所求为l
            int ll = -1, rr = n;
            while (ll + 1 != rr)
            {
                int mid = ll + rr >> 1;
                if (arr[mid] <= x) // [1 2 2 3 3] [4]
                {
                    ll = mid;
                }
                else
                {
                    rr = mid;
                }
            }
            if (arr[ll] != x)
            {
                cout << "-1 -1" << endl;
            }
            else
            {
                cout << ll << endl;
            }
        }


    }
    return 0;
}